package com.hailin.pigfeign.controller;

import com.hailin.pigapi.common.Result;
import com.hailin.pigapi.model.auth.UserInfoDto;
import com.hailin.pigfeign.service.PigAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/feign")
public class PigAuthController {

    @Autowired
    private PigAuthService pigAuthService;

    @GetMapping("/consumer")
    public Result<UserInfoDto> getUserById(@RequestParam("userId") String userId){
        Result<UserInfoDto> userInfoDto = pigAuthService.getUserById(userId);
        return userInfoDto;
    }
}
